<script type="text/javascript">
function delF() {
	if(confirm('คุณต้องการลบข้อมูลที่เลือกไว้หรือไม่')==true) {
	var frm = document.forms["myForm"];
	frm.action = "<?=site_url()?>StudentHallOfFame/deletes";
	frm.submit();
	}
}
</script>
<div id="mainContent">
<form name="myForm" action="<?=site_url()?>StudentHallOfFame/detail" method="post">
<input type="hidden" name="txtId" id="txtId" />
<table width="95%" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #0000FF; background-color: #FFFFFF">
 	<tr bgcolor="#000974">
 	<td width="50"><input type="button" value=" ลบ " onclick="delF()" ></td>
 	<td width="200px">
       	<div align="center" style="color:#FFFFFF;"><strong>ชื่อ-นามสกุล</strong></div></td>	
	<td>
       	<div align="center" style="color:#FFFFFF;"><strong>รายละเอียดผลงาน</strong></div></td>
    <td>
       	<div align="center" style="color:#FFFFFF;"><strong>แก้ไข</strong></div></td>
 	</tr>
 	
 	<?php 
 		for($i = 0; $i < count($data); $i++) {
 			if($i % 2 == 0) {
 				echo "<tr id='$i'>";
 			} else {
 				echo "<tr id='$i' bgcolor='#C6E2FF'>";
 			}?>
 		<td align="center"><input type="checkbox" name="txtDel[]" value="<?=$data[$i]->stu_id?>" > </td>
 		<td><div align="left"><?php echo $data[$i]->name;?></div></td>
 		<td><div align="left"><?php echo $data[$i]->detail;?></div></td>
 	  	<td>
 	  		<div align="center">
 	  			<input id="img<?php echo $i;?>" name="img<?php echo $i;?>" type="image" src="<?=base_url()?>images/detail_b.png" onmouseout="toBlack(this);" onmouseover="toColor(this);" value="<?php echo $data[$i]->stu_id;?>" width="25" height="25" onclick="setID(this,'<?=$data[$i]->show;?>');">
 	  		</div>
 	  	</td>
 	  	</tr>	
 	<?php } ?>
</table>
</form>
<script type="text/javascript">
function toBlack(obj) {
	obj.src = '<?=base_url()?>images/detail_b.png';
}
function toColor(obj) {
	obj.src = '<?=base_url()?>images/detail.png';
}
function setID(obj, sh) {
	document.getElementById('txtId').value = obj.value;
	if(sh == "Y") {
		document.forms["myForm"].action = "<?=site_url()?>StudentHallOfFame/detailIn";
	} else {
		document.forms["myForm"].action = "<?=site_url()?>StudentHallOfFame/detailOut";
	}
	document.forms["myForm"].submit();
}
</script>
</div>
